package interview;

import java.util.Arrays;
import java.util.Scanner;

public class test2 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int ans = 0;
        String s = sc.nextLine();
        s = s.substring(1, s.length() - 1);
        String[] s1 = s.split(",");
        String ss = sc.nextLine();
        ss = ss.substring(1, ss.length() - 1);
        String[] s2 = ss.split(",");
        int[] a = new int[s1.length];
        int[] b = new int[s2.length];
        int num = sc.nextInt();
        int p = sc.nextInt();
        for (int i = 0; i < s1.length; i++) {
            a[i] = Integer.parseInt(s1[i]);
        }

        for (int i = 0; i < s2.length; i++) {
            b[i] = Integer.parseInt(s2[i]);
        }
        Arrays.sort(a);
        Arrays.sort(b);
        for (int i = 0; i < b.length; i++) {
            for (int j = a.length - 1; j >= 0; j--) {
                if(b[i] >= a[j]){
                    ans++;
                    b[i] = -1;
                    a[j] = -1;
                    break;
                }
            }
        }
        for (int i = 0; i < b.length; i++) {
            for (int j = a.length - 1; j >= 0; j--) {
                if(num > 0 && b[i]!= -1 && a[j] != -1 && b[i] < a[j] && b[i] + p >= a[j]){
                    num--;
                    ans++;
                    b[i] = -1;
                    a[j] = -1;
                    break;
                }
            }
        }
        System.out.println(ans);
    }

}
/*
[7,10]
[0,2,3]
1
5

[3,2,1]
[0,4,4]
1
1
 */